#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

class Solution {
public:
    int hammingWeight(int n)
    {
        int ret = 0;
        while (n)
        {
            if (n % 2 == 1)
                ret++;
            n /= 2;
        }
        return ret;
    }
};